#!/usr/bin/env node

const stdin = process.stdin,
    stdout = process.stdout;
stdin.on('data',(data) => {
    //console.log(data);//data是一个buffer类型
    stdout.write(data.toString('utf8').toUpperCase());
});

//push也触发了data事件，所以hello world也变成了大写
for(let c = 'a'.charCodeAt(0);c < 'z'.charCodeAt(0);c++){
    //console.log(c);
    stdin.push(String.fromCharCode(c));
}
stdin.push('hello');
stdin.push('world');
//stdin.push(null); //终止输入
//stdin.pipe(stdout);

